//
//  NavigationController.swift
//  Box
//
//  Created by mn on 2025/3/30.
//

import UIKit
extension UINavigationController{
    func push(_ vc: UIViewController) {
        interactivePopGestureRecognizer?.isEnabled = false
        if let tabBarController =  tabBarController as? BoxTabBarController{
            tabBarController.tabBarView.isHidden = true
        }
        pushViewController(vc, animated: true)
    }
    func pop() {
        popViewController(animated: true)
        if viewControllers.count == 1, let tabBarController = tabBarController as? BoxTabBarController {
            tabBarController.tabBarView.isHidden = false
        }
    }
    func root() {
        popToRootViewController(animated: true)
        if  let tabBarController = tabBarController as? BoxTabBarController {
            tabBarController.tabBarView.isHidden = false
        }
    }
}
